Add XENVER_get_features sub-operation to HYPERVISOR_xen_version.
This operation allows a guest OS to determine which features are
supported by the running version of Xen. This changeset contains the
base infrastructure but does not implement any features yet.
Signed-off-by: Ian Campbell <Ian.Campbell@XenSource.com>
Index: xen-features/linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c
===================================================================
--- xen-features.orig/linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c 2006-01-27 11:13:22.
000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c 2006-01-27 11:27:14.
000000000 +0000
@@ -56,6 +56,7 @@
#include <asm/hypervisor.h>
#include <asm-xen/xen-public/physdev.h>
#include <asm-xen/xen-public/memory.h>
+#include <asm-xen/features.h>
#include "setup_arch_pre.h"
#include <bios_ebda.h>
@@ -1591,6 +1592,9 @@
rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0);
rd_doload = ((RAMDISK_FLAGS & RAMDISK_LOAD_FLAG) != 0);
#endif
+
+ setup_xen_features();
+
ARCH_SETUP
if (efi_enabled)
efi_init();
Index: xen-features/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c
===================================================================
--- xen-features.orig/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c 2006-01-27 11:13:22.
000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c 2006-01-27 11:27:14.
000000000 +0000
@@ -63,6 +63,7 @@
#include "setup_arch_pre.h"
#include <asm/hypervisor.h>
#include <asm-xen/xen-public/nmi.h>
+#include <asm-xen/features.h>
#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
#define PFN_PHYS(x) ((x) << PAGE_SHIFT)
#define end_pfn_map end_pfn
@@ -587,6 +588,8 @@
#endif
+ setup_xen_features();
+
HYPERVISOR_vm_assist(VMASST_CMD_enable,
VMASST_TYPE_writable_pagetables);
Index: xen-features/linux-2.6-xen-sparse/include/asm-xen/features.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.
000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/include/asm-xen/features.h 2006-01-27 11:27:14.
000000000 +0000
@@ -0,0 +1,20 @@
+/******************************************************************************
+ * features.h
+ *
+ * Query the features reported by Xen.
+ *
+ * Copyright (c) 2006, Ian Campbell
+ */
+
+#ifndef __ASM_XEN_FEATURES_H__
+#define __ASM_XEN_FEATURES_H__
+
+#include <asm-xen/xen-public/version.h>
+
+extern void setup_xen_features(void);
+
+extern unsigned long xen_features[XENFEAT_NR_SUBMAPS];
+
+#define xen_feature(flag) (test_bit(_XENFEAT_ ## flag, xen_features))
+
+#endif
Index: xen-features/xen/common/kernel.c
===================================================================
--- xen-features.orig/xen/common/kernel.c 2006-01-27 11:13:22.
000000000 +0000
+++ xen-features/xen/common/kernel.c 2006-01-27 11:27:34.
000000000 +0000
@@ -144,6 +144,28 @@
return -EFAULT;
return 0;
}
+
+ case XENVER_get_features:
+ {
+ xen_feature_info_t fi;
+
+ if ( copy_from_user(&fi, arg, sizeof(fi)) )
+ return -EFAULT;
+
+ switch ( fi.submap_idx )
+ {
+ case 0:
+ fi.submap = 0;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ if ( copy_to_user(arg, &fi, sizeof(fi)) )
+ return -EFAULT;
+ return 0;
+ }
+
}
return -ENOSYS;
Index: xen-features/xen/include/public/version.h
===================================================================
--- xen-features.orig/xen/include/public/version.h 2006-01-27 11:13:22.
000000000 +0000
+++ xen-features/xen/include/public/version.h 2006-01-27 11:27:22.
000000000 +0000
@@ -39,6 +39,14 @@
unsigned long virt_start;
} xen_platform_parameters_t;
+#define XENVER_get_features 6
+typedef struct xen_feature_info {
+ unsigned int submap_idx; /* IN: which 32-bit submap to return */
+ uint32_t submap; /* OUT: 32-bit submap */
+} xen_feature_info_t;
+
+#define XENFEAT_NR_SUBMAPS 1
+
#endif /* __XEN_PUBLIC_VERSION_H__ */
/*
Index: xen-features/linux-2.6-xen-sparse/arch/xen/kernel/features.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.
000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/arch/xen/kernel/features.c 2006-01-27 11:27:14.
000000000 +0000
@@ -0,0 +1,29 @@
+/******************************************************************************
+ * features.c
+ *
+ * Xen feature flags.
+ *
+ * Copyright (c) 2006, Ian Campbell
+ */
+#include <linux/types.h>
+#include <linux/cache.h>
+#include <asm/hypervisor.h>
+#include <asm-xen/features.h>
+
+/* When we rebase to a more recent version of Linux we can use __read_mostly here. */
+unsigned long xen_features[XENFEAT_NR_SUBMAPS] __cacheline_aligned;
+
+void setup_xen_features(void)
+{
+ uint32_t *flags = (uint32_t *)&xen_features[0];
+ xen_feature_info_t fi;
+ int i;
+
+ for (i=0; i<XENFEAT_NR_SUBMAPS; i++) {
+ fi.submap_idx = i;
+ if (HYPERVISOR_xen_version(XENVER_get_features, &fi) < 0)
+ break;
+ flags[i] = fi.submap;
+ }
+}
+
Rename funtions
early_make_page_readonly() (x86/64)
make_lowmem_page_readonly() (x86/32)
make_page_readonly() (x86)
make_pages_readonly() (x86)
make_page_writable() (x86)
make_pages_writable() (x86)
to
early_make_mmu_page_readonly()
make_lowmem_mmu_page_readonly()
make_mmu_page_readonly()
make_mmu_pages_readonly()
make_mmu_page_writable()
make_mmu_pages_writable()
These functions are only called by LDT, GDT or page table page
construction, initialisation and destruction functions and in the
future they will behave in a MMU page specific manner.
Signed-off-by: Ian Campbell <Ian.Campbell@XenSource.com>
Index: xen-features/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h
===================================================================
--- xen-features.orig/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h 2006-01-27 10:18:17.
000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h 2006-01-27 10:56:59.
000000000 +0000
@@ -413,19 +413,19 @@
} while (0)
#ifndef CONFIG_XEN_SHADOW_MODE
-void make_lowmem_page_readonly(void *va);
-void make_lowmem_page_writable(void *va);
-void make_page_readonly(void *va);
-void make_page_writable(void *va);
-void make_pages_readonly(void *va, unsigned int nr);
-void make_pages_writable(void *va, unsigned int nr);
+void make_lowmem_mmu_page_readonly(void *va);
+void make_lowmem_mmu_page_writable(void *va);
+void make_mmu_page_readonly(void *va);
+void make_mmu_page_writable(void *va);
+void make_mmu_pages_readonly(void *va, unsigned int nr);
+void make_mmu_pages_writable(void *va, unsigned int nr);
#else
-#define make_lowmem_page_readonly(_va) ((void)0)
-#define make_lowmem_page_writable(_va) ((void)0)
-#define make_page_readonly(_va) ((void)0)
-#define make_page_writable(_va) ((void)0)
-#define make_pages_readonly(_va, _nr) ((void)0)
-#define make_pages_writable(_va, _nr) ((void)0)
+#define make_lowmem_mmu_page_readonly(_va) ((void)0)
+#define make_lowmem_mmu_page_writable(_va) ((void)0)
+#define make_mmu_page_readonly(_va) ((void)0)
+#define make_mmu_page_writable(_va) ((void)0)
+#define make_mmu_pages_readonly(_va, _nr) ((void)0)
+#define make_mmu_pages_writable(_va, _nr) ((void)0)
#endif
#define virt_to_ptep(__va) \
Index: xen-features/linux-2.6-xen-sparse/arch/xen/i386/kernel/cpu/common.c
===================================================================
--- xen-features.orig/linux-2.6-xen-sparse/arch/xen/i386/kernel/cpu/common.c 2006-01-27 10:18:17.
000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/arch/xen/i386/kernel/cpu/common.c 2006-01-27 10:18:19.
000000000 +0000
@@ -572,7 +572,7 @@
va < gdt_descr->address + gdt_descr->size;
va += PAGE_SIZE, f++) {
frames[f] = virt_to_mfn(va);
- make_lowmem_page_readonly((void *)va);
+ make_lowmem_mmu_page_readonly((void *)va);
}
if (HYPERVISOR_set_gdt(frames, gdt_descr->size / 8))
BUG();
Index: xen-features/linux-2.6-xen-sparse/arch/xen/i386/kernel/ldt.c
===================================================================
--- xen-features.orig/linux-2.6-xen-sparse/arch/xen/i386/kernel/ldt.c 2006-01-27 10:18:17.
000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/arch/xen/i386/kernel/ldt.c 2006-01-27 10:56:59.
000000000 +0000
@@ -59,8 +59,8 @@
cpumask_t mask;
preempt_disable();
#endif
- make_pages_readonly(pc->ldt, (pc->size * LDT_ENTRY_SIZE) /
- PAGE_SIZE);
+ make_mmu_pages_readonly(pc->ldt, (pc->size * LDT_ENTRY_SIZE) /
+ PAGE_SIZE);
load_LDT(pc);
#ifdef CONFIG_SMP
mask = cpumask_of_cpu(smp_processor_id());
@@ -70,7 +70,7 @@
#endif
}
if (oldsize) {
- make_pages_writable(oldldt, (oldsize * LDT_ENTRY_SIZE) /
+ make_mmu_pages_writable(oldldt, (oldsize * LDT_ENTRY_SIZE) /
PAGE_SIZE);
if (oldsize*LDT_ENTRY_SIZE > PAGE_SIZE)
vfree(oldldt);
@@ -86,8 +86,8 @@
if (err < 0)
return err;
memcpy(new->ldt, old->ldt, old->size*LDT_ENTRY_SIZE);
- make_pages_readonly(new->ldt, (new->size * LDT_ENTRY_SIZE) /
- PAGE_SIZE);
+ make_mmu_pages_readonly(new->ldt, (new->size * LDT_ENTRY_SIZE) /
+ PAGE_SIZE);
return 0;
}
@@ -119,9 +119,9 @@
if (mm->context.size) {
if (mm == current->active_mm)
clear_LDT();
- make_pages_writable(mm->context.ldt,
- (mm->context.size * LDT_ENTRY_SIZE) /
- PAGE_SIZE);
+ make_mmu_pages_writable(mm->context.ldt,
+ (mm->context.size * LDT_ENTRY_SIZE) /
+ PAGE_SIZE);
if (mm->context.size*LDT_ENTRY_SIZE > PAGE_SIZE)
vfree(mm->context.ldt);
else
Index: xen-features/linux-2.6-xen-sparse/arch/xen/i386/mm/init.c
===================================================================
--- xen-features.orig/linux-2.6-xen-sparse/arch/xen/i386/mm/init.c 2006-01-27 10:18:17.
000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/arch/xen/i386/mm/init.c 2006-01-27 10:18:19.
000000000 +0000
@@ -68,7 +68,7 @@
#ifdef CONFIG_X86_PAE
pmd_table = (pmd_t *) alloc_bootmem_low_pages(PAGE_SIZE);
- make_lowmem_page_readonly(pmd_table);
+ make_lowmem_mmu_page_readonly(pmd_table);
set_pgd(pgd, __pgd(__pa(pmd_table) | _PAGE_PRESENT));
pud = pud_offset(pgd, 0);
if (pmd_table != pmd_offset(pud, 0))
@@ -89,7 +89,7 @@
{
if (pmd_none(*pmd)) {
pte_t *page_table = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
- make_lowmem_page_readonly(page_table);
+ make_lowmem_mmu_page_readonly(page_table);
set_pmd(pmd, __pmd(__pa(page_table) | _PAGE_TABLE));
if (page_table != pte_offset_kernel(pmd, 0))
BUG();
Index: xen-features/linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c
===================================================================
--- xen-features.orig/linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c 2006-01-27 10:18:17.
000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c 2006-01-27 11:01:11.
000000000 +0000
@@ -198,7 +198,7 @@
{
pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
if (pte)
- make_lowmem_page_readonly(pte);
+ make_lowmem_mmu_page_readonly(pte);
return pte;
}
@@ -344,7 +344,7 @@
pmd_t *kpmd = pmd_offset(kpud, v);
pmd_t *pmd = (void *)__va(pgd_val(pgd[i])-1);
memcpy(pmd, kpmd, PAGE_SIZE);
- make_lowmem_page_readonly(pmd);
+ make_lowmem_mmu_page_readonly(pmd);
}
pgd_list_add(pgd);
spin_unlock_irqrestore(&pgd_lock, flags);
@@ -378,7 +378,7 @@
spin_unlock_irqrestore(&pgd_lock, flags);
for (i = USER_PTRS_PER_PGD; i < PTRS_PER_PGD; i++) {
pmd_t *pmd = (void *)__va(pgd_val(pgd[i])-1);
- make_lowmem_page_writable(pmd);
+ make_lowmem_mmu_page_writable(pmd);
memset(pmd, 0, PTRS_PER_PMD*sizeof(pmd_t));
kmem_cache_free(pmd_cache, pmd);
}
@@ -389,7 +389,7 @@
}
#ifndef CONFIG_XEN_SHADOW_MODE
-void make_lowmem_page_readonly(void *va)
+void make_lowmem_mmu_page_readonly(void *va)
{
pte_t *pte = virt_to_ptep(va);
int rc = HYPERVISOR_update_va_mapping(
@@ -397,7 +397,7 @@
BUG_ON(rc);
}
-void make_lowmem_page_writable(void *va)
+void make_lowmem_mmu_page_writable(void *va)
{
pte_t *pte = virt_to_ptep(va);
int rc = HYPERVISOR_update_va_mapping(
@@ -405,7 +405,7 @@
BUG_ON(rc);
}
-void make_page_readonly(void *va)
+void make_mmu_page_readonly(void *va)
{
pte_t *pte = virt_to_ptep(va);
int rc = HYPERVISOR_update_va_mapping(
@@ -419,12 +419,12 @@
kmap_flush_unused(); /* flush stale writable kmaps */
else
#endif
- make_lowmem_page_readonly(
+ make_lowmem_mmu_page_readonly(
phys_to_virt(pfn << PAGE_SHIFT));
}
}
-void make_page_writable(void *va)
+void make_mmu_page_writable(void *va)
{
pte_t *pte = virt_to_ptep(va);
int rc = HYPERVISOR_update_va_mapping(
@@ -436,23 +436,23 @@
#ifdef CONFIG_HIGHMEM
if (pfn < highstart_pfn)
#endif
- make_lowmem_page_writable(
+ make_lowmem_mmu_page_writable(
phys_to_virt(pfn << PAGE_SHIFT));
}
}
-void make_pages_readonly(void *va, unsigned int nr)
+void make_mmu_pages_readonly(void *va, unsigned int nr)
{
while (nr-- != 0) {
- make_page_readonly(va);
+ make_mmu_page_readonly(va);
va = (void *)((unsigned long)va + PAGE_SIZE);
}
}
-void make_pages_writable(void *va, unsigned int nr)
+void make_mmu_pages_writable(void *va, unsigned int nr)
{
while (nr-- != 0) {
- make_page_writable(va);
+ make_mmu_page_writable(va);
va = (void *)((unsigned long)va + PAGE_SIZE);
}
}
Index: xen-features/linux-2.6-xen-sparse/arch/xen/kernel/smpboot.c
===================================================================
--- xen-features.orig/linux-2.6-xen-sparse/arch/xen/kernel/smpboot.c 2006-01-27 10:18:17.
000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/arch/xen/kernel/smpboot.c 2006-01-27 10:18:19.
000000000 +0000
@@ -239,7 +239,7 @@
memcpy((void *)cpu_gdt_descr[cpu].address,
(void *)cpu_gdt_descr[0].address,
cpu_gdt_descr[0].size);
- make_page_readonly((void *)cpu_gdt_descr[cpu].address);
+ make_mmu_page_readonly((void *)cpu_gdt_descr[cpu].address);
cpu_set(cpu, cpu_possible_map);
#ifdef CONFIG_HOTPLUG_CPU
Index: xen-features/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/ldt.c
===================================================================
--- xen-features.orig/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/ldt.c 2006-01-27 10:18:17.
000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/ldt.c 2006-01-27 10:56:59.
000000000 +0000
@@ -65,8 +65,8 @@
preempt_disable();
#endif
- make_pages_readonly(pc->ldt, (pc->size * LDT_ENTRY_SIZE) /
- PAGE_SIZE);
+ make_mmu_pages_readonly(pc->ldt, (pc->size * LDT_ENTRY_SIZE) /
+ PAGE_SIZE);
load_LDT(pc);
#ifdef CONFIG_SMP
mask = cpumask_of_cpu(smp_processor_id());
@@ -76,7 +76,7 @@
#endif
}
if (oldsize) {
- make_pages_writable(oldldt, (oldsize * LDT_ENTRY_SIZE) /
+ make_mmu_pages_writable(oldldt, (oldsize * LDT_ENTRY_SIZE) /
PAGE_SIZE);
if (oldsize*LDT_ENTRY_SIZE > PAGE_SIZE)
vfree(oldldt);
@@ -92,8 +92,8 @@
if (err < 0)
return err;
memcpy(new->ldt, old->ldt, old->size*LDT_ENTRY_SIZE);
- make_pages_readonly(new->ldt, (new->size * LDT_ENTRY_SIZE) /
- PAGE_SIZE);
+ make_mmu_pages_readonly(new->ldt, (new->size * LDT_ENTRY_SIZE) /
+ PAGE_SIZE);
return 0;
}
@@ -131,9 +131,9 @@
if (mm->context.size) {
if (mm == current->active_mm)
clear_LDT();
- make_pages_writable(mm->context.ldt,
- (mm->context.size * LDT_ENTRY_SIZE) /
- PAGE_SIZE);
+ make_mmu_pages_writable(mm->context.ldt,
+ (mm->context.size * LDT_ENTRY_SIZE) /
+ PAGE_SIZE);
if (mm->context.size*LDT_ENTRY_SIZE > PAGE_SIZE)
vfree(mm->context.ldt);
else
Index: xen-features/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c
===================================================================
--- xen-features.orig/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c 2006-01-27 10:18:17.
000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c 2006-01-27 10:18:19.
000000000 +0000
@@ -141,7 +141,7 @@
va < gdt_descr->address + gdt_descr->size;
va += PAGE_SIZE, f++) {
frames[f] = virt_to_mfn(va);
- make_page_readonly((void *)va);
+ make_mmu_page_readonly((void *)va);
}
if (HYPERVISOR_set_gdt(frames, gdt_descr->size /
sizeof (struct desc_struct)))
Index: xen-features/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c
===================================================================
--- xen-features.orig/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c 2006-01-27 10:18:17.
000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c 2006-01-27 11:01:11.
000000000 +0000
@@ -66,7 +66,7 @@
(((mfn_to_pfn((addr) >> PAGE_SHIFT)) << PAGE_SHIFT) + \
__START_KERNEL_map)))
-static void early_make_page_readonly(void *va)
+static void early_make_mmu_page_readonly(void *va)
{
unsigned long addr, _va = (unsigned long)va;
pte_t pte, *ptep;
@@ -88,7 +88,7 @@
BUG();
}
-void make_page_readonly(void *va)
+void make_mmu_page_readonly(void *va)
{
pgd_t *pgd; pud_t *pud; pmd_t *pmd; pte_t pte, *ptep;
unsigned long addr = (unsigned long) va;
@@ -103,10 +103,10 @@
xen_l1_entry_update(ptep, pte); /* fallback */
if ((addr >= VMALLOC_START) && (addr < VMALLOC_END))
- make_page_readonly(__va(pte_pfn(pte) << PAGE_SHIFT));
+ make_mmu_page_readonly(__va(pte_pfn(pte) << PAGE_SHIFT));
}
-void make_page_writable(void *va)
+void make_mmu_page_writable(void *va)
{
pgd_t *pgd; pud_t *pud; pmd_t *pmd; pte_t pte, *ptep;
unsigned long addr = (unsigned long) va;
@@ -121,21 +121,21 @@
xen_l1_entry_update(ptep, pte); /* fallback */
if ((addr >= VMALLOC_START) && (addr < VMALLOC_END))
- make_page_writable(__va(pte_pfn(pte) << PAGE_SHIFT));
+ make_mmu_page_writable(__va(pte_pfn(pte) << PAGE_SHIFT));
}
-void make_pages_readonly(void *va, unsigned nr)
+void make_mmu_pages_readonly(void *va, unsigned nr)
{
while (nr-- != 0) {
- make_page_readonly(va);
+ make_mmu_page_readonly(va);
va = (void*)((unsigned long)va + PAGE_SIZE);
}
}
-void make_pages_writable(void *va, unsigned nr)
+void make_mmu_pages_writable(void *va, unsigned nr)
{
while (nr-- != 0) {
- make_page_writable(va);
+ make_mmu_page_writable(va);
va = (void*)((unsigned long)va + PAGE_SIZE);
}
}
@@ -223,7 +223,7 @@
pud = (user_mode ? pud_offset_u(vaddr) : pud_offset(pgd, vaddr));
if (pud_none(*pud)) {
pmd = (pmd_t *) spp_getpage();
- make_page_readonly(pmd);
+ make_mmu_page_readonly(pmd);
xen_pmd_pin(__pa(pmd));
set_pud(pud, __pud(__pa(pmd) | _KERNPG_TABLE | _PAGE_USER));
if (pmd != pmd_offset(pud, 0)) {
@@ -234,7 +234,7 @@
pmd = pmd_offset(pud, vaddr);
if (pmd_none(*pmd)) {
pte = (pte_t *) spp_getpage();
- make_page_readonly(pte);
+ make_mmu_page_readonly(pte);
xen_pte_pin(__pa(pte));
set_pmd(pmd, __pmd(__pa(pte) | _KERNPG_TABLE | _PAGE_USER));
if (pte != pte_offset_kernel(pmd, 0)) {
@@ -276,7 +276,7 @@
if (pud_none(*pud)) {
pmd = (pmd_t *) spp_getpage();
- make_page_readonly(pmd);
+ make_mmu_page_readonly(pmd);
xen_pmd_pin(__pa(pmd));
set_pud(pud, __pud(__pa(pmd) | _KERNPG_TABLE | _PAGE_USER));
@@ -290,7 +290,7 @@
if (pmd_none(*pmd)) {
pte = (pte_t *) spp_getpage();
- make_page_readonly(pte);
+ make_mmu_page_readonly(pte);
xen_pte_pin(__pa(pte));
set_pmd(pmd, __pmd(__pa(pte) | _KERNPG_TABLE | _PAGE_USER));
@@ -419,7 +419,7 @@
}
pmd = alloc_static_page(&pmd_phys);
- early_make_page_readonly(pmd);
+ early_make_mmu_page_readonly(pmd);
xen_pmd_pin(pmd_phys);
set_pud(pud, __pud(pmd_phys | _KERNPG_TABLE));
for (j = 0; j < PTRS_PER_PMD; pmd++, j++) {
@@ -448,7 +448,7 @@
__set_pte(pte, __pte(paddr | _KERNPG_TABLE));
}
pte = pte_save;
- early_make_page_readonly(pte);
+ early_make_mmu_page_readonly(pte);
xen_pte_pin(pte_phys);
set_pmd(pmd, __pmd(pte_phys | _KERNPG_TABLE));
}
@@ -497,11 +497,11 @@
_KERNPG_TABLE | _PAGE_USER);
memcpy((void *)level2_kernel_pgt, page, PAGE_SIZE);
- early_make_page_readonly(init_level4_pgt);
- early_make_page_readonly(init_level4_user_pgt);
- early_make_page_readonly(level3_kernel_pgt);
- early_make_page_readonly(level3_user_pgt);
- early_make_page_readonly(level2_kernel_pgt);
+ early_make_mmu_page_readonly(init_level4_pgt);
+ early_make_mmu_page_readonly(init_level4_user_pgt);
+ early_make_mmu_page_readonly(level3_kernel_pgt);
+ early_make_mmu_page_readonly(level3_user_pgt);
+ early_make_mmu_page_readonly(level2_kernel_pgt);
xen_pgd_pin(__pa_symbol(init_level4_pgt));
xen_pgd_pin(__pa_symbol(init_level4_user_pgt));
@@ -539,7 +539,7 @@
pmd = (pmd_t *)&page[pmd_index(va)];
if (pmd_none(*pmd)) {
pte_page = alloc_static_page(&phys);
- early_make_page_readonly(pte_page);
+ early_make_mmu_page_readonly(pte_page);
xen_pte_pin(phys);
set_pmd(pmd, __pmd(phys | _KERNPG_TABLE | _PAGE_USER));
} else {
@@ -586,7 +586,7 @@
for (; start < end; start = next) {
unsigned long pud_phys;
pud_t *pud = alloc_static_page(&pud_phys);
- early_make_page_readonly(pud);
+ early_make_mmu_page_readonly(pud);
xen_pud_pin(pud_phys);
next = start + PGDIR_SIZE;
if (next > end)
@@ -791,11 +791,11 @@
set_page_count(virt_to_page(addr), 1);
memset((void *)(addr & ~(PAGE_SIZE-1)), 0xcc, PAGE_SIZE);
xen_pte_unpin(__pa(addr));
- make_page_writable(__va(__pa(addr)));
+ make_mmu_page_writable(__va(__pa(addr)));
/*
* Make pages from __PAGE_OFFSET address as well
*/
- make_page_writable((void *)addr);
+ make_mmu_page_writable((void *)addr);
free_page(addr);
totalram_pages++;
}
Index: xen-features/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgalloc.h
===================================================================
--- xen-features.orig/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgalloc.h 2006-01-27 10:18:17.
000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgalloc.h 2006-01-27 10:56:59.
000000000 +0000
@@ -7,10 +7,10 @@
#include <linux/mm.h>
#include <asm/io.h> /* for phys_to_virt and page_to_pseudophys */
-void make_page_readonly(void *va);
-void make_page_writable(void *va);
-void make_pages_readonly(void *va, unsigned int nr);
-void make_pages_writable(void *va, unsigned int nr);
+void make_mmu_page_readonly(void *va);
+void make_mmu_page_writable(void *va);
+void make_mmu_pages_readonly(void *va, unsigned int nr);
+void make_mmu_pages_writable(void *va, unsigned int nr);
#define __user_pgd(pgd) ((pgd) + PTRS_PER_PGD)
@@ -161,7 +161,7 @@
{
pte_t *pte = (pte_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
if (pte)
- make_page_readonly(pte);
+ make_mmu_page_readonly(pte);
return pte;
}
@@ -181,7 +181,7 @@
{
BUG_ON((unsigned long)pte & (PAGE_SIZE-1));
xen_pte_unpin(__pa(pte));
- make_page_writable(pte);
+ make_mmu_page_writable(pte);
free_page((unsigned long)pte);
}
Index: xen-features/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgalloc.h
===================================================================
--- xen-features.orig/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgalloc.h 2006-01-27 11:01:53.
000000000 +0000
+++ xen-features/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgalloc.h 2006-01-27 11:02:07.
000000000 +0000
@@ -42,7 +42,7 @@
static inline void pte_free_kernel(pte_t *pte)
{
free_page((unsigned long)pte);
- make_page_writable(pte);
+ make_mmu_page_writable(pte);
}
extern void pte_free(struct page *pte);
Remove unneeded /proc/xen/grant and its libxc wrapper.
Signed-off-by: Keir Fraser <keir@xensource.com>
Merge.
Signed-off-by: Steven Smith, sos22@cam.ac.uk
Fix 64-bit build.
Signed-off-by: Steven Smith, sos22@cam.ac.uk
Fix the 64-bit build.
Signed-off-by: Keir Fraser <keir@xensource.com>
Merge.
Signed-off-by: Steven Smith, sos22@cam.ac.uk
Change domain_crash to say where it was called from.
Signed-off-by: Steven Smith, sos22@cam.ac.uk
Separate the validity checking of the page frame in 2 chunks.
give a more accurate error message, and don't call pfn_to_page before
validating the pfn.
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
Fix inline asm hypercall argument parameter indexes.
Signed-off-by: Keir Fraser <keir@xensource.com>
Missing put_page_and_type() in dom0_op hypercall.
Signed-off-by: Keir Fraser <keir@xensource.com>
Indirect hypercalls through a hypercall transfer page.
Signed-off-by: Keir Fraser <keir@xensource.com>
Adding __init__.py file to remove build warning.
It turns out the hg export command does not include zero
size files in the generated diff and this was overlooked.
This patch make xm reboot/shutdown work for vmx doamin.
xm reboot fails due to two issues:
1. no mechanism to change XendDomainInfo.info to trigger domain reboot
2. ioemu blkif parameter is missing during reboot, thus device model recreation will fail.
This patch fix these issues by
1. introducing a xswatch to monitor the control/shutdown node. once fired, it will change the XendDomainInfo.info to trigger domain reboot
2. saving the ioemu blkif parameter in xen store just like DomU does.
Signed-off-by: Yu Ke <ke.yu@intel.com>
Merged.
reindent few lines that were using softtab instead of hardtab.
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
add some checking of opening and read in dom0_init and return -1 if error.
instead of crashing, it now prints a more meaningful error message.
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
use format printf style to write to tracefd instead of using write syscall.
add a static buffer to trace() instead of always allocating from the heap.
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
Two shell commands weren't properly spaced in a makefile.
Signed-off-by: Jan Beulich <JBeulich@novell.com>
fixup memory leak and return value, if malloc or realloc fail.
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
fixup reallocation to "twice the size + 1", instead of "3 times the size".
max *= 2 + 1 <==> max *= 3
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
ia64 specific part of gdbstub.
Signed-off-by: Isaku Yamahtata <yamahata@valinux.co.jp>
Fix a bug that causes storage key auth to be generated twice.
Signed-off-by: Vinnie Scarlata <vincent.r.scarlata@intel.com>
Delete 2 unused Kconfig files.
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
No longer call xc_vcpu_getcontext() on restore (required after cset 8610).
Signed-off-by: Steven Hand <steven@xensource.com>
Remove the spin on VCPUF_running from context_switch().
It doesn't work because we already set VCPUF_running
locally, and the scheduler should not pick another CPU's
VCPUF_running VCPU anyway, since it mustn't modify the
processor field.
Instead just add a simple assertion to the scheduler to
ensure the scheduling algorithm is not picking an
inappropriate VCPU.
Signed-off-by: Keir Fraser <keir@xensource.com>
return -ENOMEM value instead of -1 when running out of memory.
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
sanitize tpmfront. missing spin_unlock'ing in error paths and fix coding style.
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
bool type doesn't exist in C, don't try to emulate one.
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
remove ASSERT macro.
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
replace ASSERT by BUG_ON.
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
fix xenbus_scanf called with NULL instead of XBT_NULL.
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
use standard pr_debug macro for DPRINTK.
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
remove ASSERT macro that is not used anymore in blkback.
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
remove unnecessary macro bdev_put which is an alias to blkdev_put.
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
Complete arch_domain_create refactoring for ia64.
Signed-off-by: Kevin Tian <kevin.tian@intel.com>
Some refactoring of domain creation/destruction.
Interface name changes:
1. do_createdomain -> domain_create
2. domain_destruct -> domain_destroy
Arch-specific changes:
1. arch_do_createdomain -> arch_domain_create
This function now takes a domain pointer, not a VCPU
pointer! Initialisation of VCPU0 must happen in
alloc_vcpu_struct().
2. free_perdomain_pt -> arch_domain_destroy
This function must undo the work of arch_domain_create
TODO: arch_domain_create() refactoring is not completed
for ia64.
Signed-off-by: Keir Fraser <keir@xensource.com>
Fix 64-bit build with crash_debug enabled.
Signed-off-by: Keir Fraser <keir@xensource.com>
Rename cdb to gdbstub and split it into arch dependent/neutral part.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Fix the issue of system crash in vmx stress test.
There is a path that shadow L2 table is assigned
after it is unshadowed in stress test.
Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>
Make all nmi debugkey tracing arch specific.
Signed-off-by: Keir Fraser <keir@xensource.com>
Correctly handle dumping a VM86 guest's stack.
If the guest context is VM86 then we need to treat ss:sp as 16 bit
segment:offset rather than 32 bit selector:offset.
Signed-off-by: Ian Campbell <Ian.Campbell@XenSource.com>
Make xmexaple.vti support network option too and other small modifications for convenient use.
Signed-off-by Zhang xiantao <xiantao.zhang@intel.com>
Unused page struct fields commented out.
Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
add prototype of guest_cpu_user_regs() which is used by ns16550_poll().
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Debug keyhandlers for triggering an NMI and examine current NMI state.
Add 'N' keyhandler to dump the current per CPU NMI counts and the
current NMI mask/pending status.
Add 'n' keyhandler to trigger an NMI by sending an IPI. For some
reason the destination shorthand for self is not valid when used with
the NMI delivery mode so we send the IPI to our own APIC ID
explicitly.
Signed-off-by: Ian Campbell <Ian.Campbell@XenSource.com>
Enable warnings and fix a few one (those which occur in almost every file).
The next step is to fix warnings one by one.
Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
# User tristan.gingold@bull.net
Ensure watchdog remains disabled unless enabled on the command line.
Bail out of setup_apic_nmi_watchdog() early if watchdog is not
enabled. Is the watchdog is disabled then increment
watchdog_disable_count to prevent it ever becoming enabled.
Unconditionally call setup_apic_nmi_watchdog() from setup_local_APIC()
so that the above is guaranteed to have occurred before the first call
of watchdog_enable().
Signed-off-by: Ian Campbell <Ian.Campbell@XenSource.com>
Fix x86/32 do_iret implementation, fixes VM86 mode.
Do not clobber a freshly restored esp when performing an iret.
Signed-off-by: Keir Fraser <keir@xensource.com>
Signed-off-by: Ian Campbell <Ian.Campbell@XenSource.com>
Fix non-debug build.
Signed-off-by: Keir Fraser <keir@xensource.com>
Add missing renamed files. Oops.
Signed-off-by: Keir Fraser <keir@xensource.com>
Fix compile warning about uninitialised vars.
Signed-off-by: Keir Fraser <keir@xensource.com>
More debug print cleanups.
Signed-off-by: Keir Fraser <keir@xensource.com>